package feifei;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/demo02.action")
public class
Demo02Servlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        req.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html,charset=UTF-8");
        //通过内部转发，让服务器访问webapp目录下的demo02.html.把demo02.html页面响应给客户端
        //内部转发地址：就是请求路径，没有虚拟目录
        RequestDispatcher dispatcher = req.getRequestDispatcher("/demo02.html");
        dispatcher.forward(req,resp);

    }
}
